﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

using NS_QuangCaoTiepThiBUS;

namespace NS_QuangCaoTiepThi
{
    /// <summary>
    /// Summary description for SlideService1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class SlideService1 : System.Web.Services.WebService
    {

        [WebMethod]
        public AjaxControlToolkit.Slide[] GetSlideKhachHang()
        {
            //AjaxControlToolkit.Slide[] slide = new AjaxControlToolkit.Slide[7];
            //slide[0] = new AjaxControlToolkit.Slide("HinhAnh/httv_120x240_160312.jpg", "Chrysanthemum", "a");
            //slide[1] = new AjaxControlToolkit.Slide("HinhAnh/Hamony card_1.jpg", "Desert", "b");
            //return slide;

            NoiDungBUS ndBUS = new NoiDungBUS();
            IList<NoiDung> danhSachHinhAnhKhachHang = ndBUS.LayDanhSachHinhAnhKhachHang();

            AjaxControlToolkit.Slide[] slide = new AjaxControlToolkit.Slide[danhSachHinhAnhKhachHang.Count];
            int i = 0;
            foreach (NoiDung nd in danhSachHinhAnhKhachHang)
            {
                slide[i] = new AjaxControlToolkit.Slide("QCTT/Images/" + nd.TenFileHinhAnhKhachHang, "", "");
                i++;
            }

            return slide;
        }
    }
}
